package com.gang.mars.basic.annotation;

import lombok.SneakyThrows;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author gang.chen
 * @Date 2022/9/14 13:21
 */
@Apple03Anno(scanBasePackage = "com.gang.mars.basic")
public class Apple03Main {

    @SneakyThrows
    public static void main(String[] args) throws ClassNotFoundException {

        Class<?> aClass = Class.forName(Apple03Main.class.getName());

        Annotation[] declaredAnnotations = aClass.getDeclaredAnnotations();



        for (int i = 0; i < declaredAnnotations.length; i++) {

            Annotation declaredAnnotation = declaredAnnotations[i];

            Class<? extends Annotation> annotationType = declaredAnnotation.annotationType();

            Method[] declaredMethods = annotationType.getDeclaredMethods();

            for (int i1 = 0; i1 < declaredMethods.length; i1++) {

                Method declaredMethod = declaredMethods[i1];

                Object invoke = declaredMethod.invoke(declaredAnnotation);
            }
        }
    }
}
